﻿<Window x:Class="Filas.Queues"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Fila" Height="660" Width="800" SizeChanged="grid_SizeChanged" Background="Black" 
        ResizeMode="CanMinimize" MinHeight="660" MinWidth="800">
    
    <Window.Resources>

        <ResourceDictionary>
            
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/CommomFunctions;component/Styles.xaml"/>
            </ResourceDictionary.MergedDictionaries>
            
            <Style TargetType="{x:Type Button}">
                <Setter Property = "Height" Value="28" />
                <Setter Property = "MinWidth" Value="80" />
                <Setter Property = "IsEnabled" Value="False" />
                <Setter Property = "Grid.Row" Value="3" />
                <Setter Property = "Grid.ColumnSpan" Value="2" />
                <Setter Property = "VerticalAlignment" Value="Top" />
                <Setter Property = "HorizontalAlignment" Value="Center" />
            </Style>
            
        </ResourceDictionary>

    </Window.Resources>
    
    <Grid Name="Gridi" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" ShowGridLines="False" Margin="0" ClipToBounds="True">
        <Grid.RowDefinitions>
            <RowDefinition Height="20*" />
            <RowDefinition Height="10*" />
            <RowDefinition Height="70*" />
            <RowDefinition Height="40*" />
            <RowDefinition Height="40*" />
            <RowDefinition Height="40*" />
        </Grid.RowDefinitions>
        
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="50*" />
            <ColumnDefinition Width="50*" />
            <ColumnDefinition Width="50*" />
            <ColumnDefinition Width="50*" />
            <ColumnDefinition Width="50*" />
            <ColumnDefinition Width="50*" />
        </Grid.ColumnDefinitions>

        <Button Name="btnInsert" Click="btnInsert_Click" Grid.Column="2" Margin="25,25,25,0">Inserir</Button>
        <Button Name="btnRemove" Click="btnRemove_Click" Grid.Column="2" Margin="25,65,25,0">Remover</Button>

        <Button Name="btnCreate" Click="btnCreate_Click" Grid.Column="1" IsEnabled="True" Margin="25,25,25,0">Criar Fila</Button>
        <Button Name="btnDestroy" Click="btnDestroy_Click" Grid.Column="1" Margin="25,65,25,0">Destruir Fila</Button>

        <Menu Grid.Row="0" Margin="0" VerticalAlignment="Top" HorizontalAlignment="Left">
            <MenuItem Header="_Ajuda">
                <MenuItem Name="help" Click="help_Click" Header="Ajuda Estrutura de Dados"/>
                <MenuItem Name="tutorial" Click="tutorial_Click" Header="Tutorial"/>
                <MenuItem Name="about" Click="about_Click" Header="Sobre"/>
            </MenuItem>
        </Menu>
        
        <RichTextBox Name="txtCode" Margin="25,64,14,10" Height="230"  Grid.Column="3" Grid.ColumnSpan="3" Grid.Row="3" Grid.RowSpan="3" MaxWidth="320"
                 AcceptsTab="True" AcceptsReturn="True" VerticalAlignment="Bottom" VerticalScrollBarVisibility="Auto" IsReadOnly="True" Background="Black" >

            <FlowDocument>
                <Paragraph FontFamily="comic sans" Foreground="AntiqueWhite" FontSize="19">Operações Básicas com Filas em C#</Paragraph>

                <Paragraph Foreground="LawnGreen" FontSize="15">// Cria nova fila
                    <LineBreak/>
                    <Run Foreground="SkyBlue">Queue</Run>
                    <Run Foreground="LightGray">minhaFila =</Run>
                    <Run Foreground="Blue">new</Run>
                    <Run Foreground="SkyBlue">Queue</Run>
                    <Run Foreground="LightGray">( );</Run>
                </Paragraph>

                <Paragraph Foreground="LawnGreen" FontSize="15">// Insere o elemento no final da fila
                    <LineBreak/>
                    <Run Foreground="LightGray">minhaFila.Enqueue( elemento );</Run>
                </Paragraph>

                <Paragraph Foreground="LawnGreen" FontSize="15">// Remove o elemento do início da fila
                    <LineBreak/>
                    <Run Foreground="LightGray">minhaFila.Dequeue( );</Run>
                </Paragraph>
            </FlowDocument>
        </RichTextBox>

    </Grid>
</Window>
